import request from '@/utils/request'

export function closeBatch(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/closeBatch',
        method: 'post',
        data: params
    })
}

export function create(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/create',
        method: 'post',
        data: params
    })
}

export function deleteBatch(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/deleteBatch',
        method: 'post',
        data: params
    })
}

export function getSelect(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/select',
        method: 'post',
        data: params
    })
}

export function selectAllWorkOrderStatusName() {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/selectAllWorkOrderStatusName',
        method: 'get'
    })
}

export function selectAllWorkOrderTypeName() {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/selectAllWorkOrderTypeName',
        method: 'get'
    })
}

export function selectById(id) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/selectById?id=' + id,
        method: 'get'
    })
}

export function selectByUserId(id) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/workOrderTypeMenu/selectByUserId?id=' + id,
        method: 'get'
    })
}
// 获取合并工单
export function getCombineWorkOrderInfo(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/getCombineWorkOrderInfo',
        method: 'post',
        data: params
    })
}

export function getByTaskId(id) { // 获取返回json
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/getByTaskId?taskId=' + id,
        method: 'get'
    })
}

export function getCreateNode(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/getCreateNode?workOrderTypeId=' + params.workOrderTypeId + '&formTemplateId=' + Number(params.formTemplateId),
        method: 'get'
    })
}

export function getSelectableNodes(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/getSelectableNodes?workOrderTypeId=' + params.workOrderTypeId + '&nodeId=' + params.nodeId,
        method: 'get'
    })
}

export function selectAllType() {
    return request({
        url: window.CONFIG.workOrderRestIp + '/role/selectAllType',
        method: 'get'
    })
}

export function selectAll(id) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/role/selectAll?type=' + id,
        method: 'get'
    })
}

export function deleteReminder(id) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/workOrderUrge/delete?id=' + id,
        method: 'get'
    })
}

export function getPreviousOrNextDetail(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/getPreviousOrNextDetail',
        method: 'post',
        data: params
    })
}

export function getProcessMessage(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/getProcessMessage?id=' + params.id + '&userId=' + params.userId,
        method: 'get'
    })
}

export function processWorkOrder(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/processWorkOrder',
        method: 'post',
        data: params
    })
}

export function redeployWorkOrder(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/redeployWorkOrder',
        method: 'post',
        data: params
    })
}

export function writeWithHead(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/workOrderExcelOutDto/writeWithHead',
        method: 'post',
        data: params,
        responseType: 'blob',
        timeout: 200000
    })
}

export function getWorkOrderList(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/getWorkOrderList',
        method: 'post',
        data: params
    })
}

// 根据账号获取开户行
export function getBankAddress(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/EripDataSyn/getBankAddress?bankCardNum=' + params.bankCardNum,
        method: 'get'
    })
}
// 获取关联工单的相关信息
export function getConcatWorkOrderList(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/getConcatWorkOrderList',
        method: 'post',
        data: params
    })
}

// 取消关联工单
export function cancleConcatWorkOrder(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/cancleConcatWorkOrder?currentWorkOrderId=' + params.currentWorkOrderId + '&concatWorkOrderId=' + params.concatWorkOrderId,
        method: 'get'
    })
}
// 获取工单日志
export function getLoglist(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/workOrderLog/getLoglist',
        method: 'post',
        data: params
    })
}
export function updateBatch(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/workOrderUrge/updateBatch',
        method: 'post',
        data: params
    })
}

// 获取短信模板
export function getMsgTemplate(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/EripDataSyn/getMsgTemplate?classify=' + params.classify,
        method: 'get'
    })
}
// 获取投管系统中工单处理轨迹
// export function getTsWorkOrderInfo (params) {
//   return request({
//     url: window.CONFIG.workOrderRestIp + '/TsTaskInfo/getTsWorkOrderInfo?workOrderId=' + params.workOrderId,
//     method: 'get'
//   })
// }

// 调取录音
export function getVoiceInfo(params, userId, tenantId) {
    return request({
        // url: 'http://10.50.2.11/workorder/edp/v1/freelink/record/query/' + tenantId + '/' + userId,
        url: window.CONFIG.baseRestIp + '/edp/v1/freelink/record/query/' + tenantId + '/' + userId,
        // url: 'http://222.73.213.181:8080/edp/query/default/system?pageNumber=1&pageSize=10',
        data: params,
        method: 'post'
    })
}
// 获取会话内容
export function getChatContent(params) {
    return request({
        url: window.CONFIG.baseRestIp + '/dbsrv/v1/history/all2/' + params.tenantId + '/' + params.sessionId + '/' + params.agentId,
        // url: ' http://49.235.229.66/dbsrv/v1/history/all2/' + params.tenantId + '/' + params.sessionId + '/' + params.agentId,
        method: 'get'
    })
}
// 回访工单角色
export function getAllUserListByRoleCode(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/user/getAllUserListByRoleCode?roleCode=' + params.roleCode,
        method: 'get'
    })
}

// 获取改派的用户

export function getUpdateCurrentHandler(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/updateCurrentHandler',
        data: params,
        method: 'post'
    })
}
// 根据类型节点id获取用户列表(转派)
export function getNodeHandleUserInfoByNodeId(id) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/workOrderTypeNode/getNodeHandleUserInfoByNodeId?workOrderTypeNodeId=' + id,
        method: 'get'
    })
}
// 根据类型节点id获取用户列表
// export function workOrderTypeNodeId(id) {
//   return request({
//       url: window.CONFIG.workOrderRestIp + '/workOrderTypeNode/getNodeInfoByNodeId?workOrderTypeNodeId=' + id,
//       method: 'get'
//   })
// }
// 根据工单流程节点id获取坐席列表(改派)
export function getUserListByWorkOrderTypeNodeId(id) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/user/getUserListByWorkOrderTypeNodeId?workOrderTypeNodeId=' + id,
        method: 'get'
    })
}

// 根据过滤器查询当前节点的模板
export function getBatchProcessInfo(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/getBatchProcessInfo',
        data: params,
        method: 'post'
    })
}
// 批量处理的操作
export function batchProcessWorkOrder(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/batchProcessWorkOrder',
        data: params,
        method: 'post'
    })
}
// 获取工单流程
export function getWorkOrderTypeList(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/workOrderType/getWorkOrderTypeList',
        data: params,
        method: 'post'
    })
}
// 领取工单
export function workOrderRecieve(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/workOrderRecieve',
        data: params,
        method: 'post'
    })
}
// 工单关注和取消关注
export function monitorAndCancelWorkOrder(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/monitorAndCancelWorkOrder',
        data: params,
        method: 'post'
    })
}
// 工单撤回
export function withdrawWorkOrder(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/withdrawWorkOrder',
        data: params,
        method: 'post'
    })
}

// 获取工单流程
export function getWorkOrderTypeByUserId(id) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/workOrderType/getWorkOrderTypeByUserId?userId=' + id,
        method: 'get'
    })
}
// 更新跟进人
export function updateBusinessHandler(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/updateBusinessHandler',
        data: params,
        method: 'post'
    })
}

// 转入接口
export function externalFlowIntoInterface() {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/externalFlowIntoInterface',
        method: 'get'
    })
}


export function tableHeadField(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/tableHeadField/select',
        method: 'post',
        data: params
    })
}
export function allBaseBussinessField(id) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/allBaseBussinessField?workOrderTypeId=' + id,
        method: 'get'
    })
}

// 驳回意见
export function workOrderBackToLastStep(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/workOrderBackToLastStep',
        method: 'post',
        data: params
    })
}

export function advancedFilterData(params) {
    return request({
        url: window.CONFIG.workOrderRestIp + '/WorkOrder/advancedFilterData?workOrderFilterMenuId=' + params.workOrderFilterMenuId,
        method: 'get'
    })
}